"""Codepoint-based collation.

This collation backend sorts using only the basic codepoint order. It
is primarily intended to be used as a baseline and example for other
collation backends.

Use this collation backend if...
 - You are writing tests for pycollate.
 - You are writing specialized Unicode software.
 - You are on a system with no locale module.

Avoid this backend if...
 - You are writing a normal program for a normal runtime environment.
 - You are sorting strings to show normal humans.

"""

__all__ = ["Collator"]

import collate._abcollator
import collate._locale

class Collator(collate._abcollator.Collator):
    """Codepoint-based collation.

    Arguments
    locale - all parts but encoding ignored, always 'C'
    encoding - try to use this string encoding
    """

    def __init__(self, locale=None, encoding=None):
        super(Collator, self).__init__(locale, encoding)
        dummy, self.encoding = collate._locale.getpair(locale, encoding)
        self.locale = "C"
